package com.lprotect.web.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lprotect.web.dto.req.LProtectCardListReqDTO;
import com.lprotect.web.entity.LUserInfo;
import com.lprotect.web.service.LProtectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
@Slf4j
@RestController
public class SprotectMainController {

    @Resource
    private LProtectService lProtectService;

    /**
     * 分页查询 - 用户
     */
    @PostMapping(value = "/selectPageListUser", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<IPage<LUserInfo>> selectPageListUser(@RequestBody @Validated LProtectCardListReqDTO reqDTO) {
        return ResponseEntity.ok(lProtectService.selectPageList(reqDTO));
    }

    /**
     * 分页查询 - 卡密
     */
    @PostMapping(value = "/selectPageListCard", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity selectPageListCard(@RequestBody @Validated LProtectCardListReqDTO reqDTO) {
        return ResponseEntity.ok(lProtectService.selectPageList(reqDTO));
    }

    /**
     *
     */
}
